<?php
define('CLASS_PATH', 		'TVB/Logger/Appender/');
define('DEFAULT_LABEL', 	'root');
define('DEFAULT_APPENDER', 	'stdout');
define('CONFIG_APC_KEY', 	'TVB_LOGGER_CONFIG');
define('CONFIG_APC_TLL', 	'600');
define('LEVEL_NAME', 		'level');
define('APPENDER_NAME', 	'appender');
define('CLASS_NAME', 		'out_class');
define('LIP_PATH', 			'lib_path');
/**
 * tvb log init
 * 
 * @author William Hu <william.hu@achievo.com>
 * @version 1.0
 * @package TVBLog
 */
class TVBLog
{
    /**
     * @var array of $Log where the keys are the
     * category and the values are the category names
     */
    public static $Log = array();

	/**
     * get config.
     *
     * @return vod
     */		
	public static function config($path)
	{
		if (!file_exists($path)) {
			require_once 'TVB/Logger/Exception.php';
			throw new TVB_Logger_Exception('No exists config file:'.$path);
		}
		require_once 'TVB/Logger/Config.php';
		require_once 'TVB/Logger/Categroy.php';
		TVB_Logger_Config::init($path);
		
		$labels = TVB_Logger_Config::labels();
		foreach ($labels as $label) {
			self::$Log[$label] = new TVB_Logger_Categroy($label);
		}
	}
	
	/**
     * debug log.
     *
     * @return vod
     */			
	public static function debug($msg)
	{
		return self::$Log['root']->debug($msg);
	}
	
	/**
     * info log.
     *
     * @return vod
     */		
	public static function info($msg)
	{
		return self::$Log['root']->info($msg);
	}

	/**
     * warn log.
     *
     * @return vod
     */			
	public static function warn($msg)
	{
		return self::$Log['root']->warn($msg);
	}
	
	/**
     * error log.
     *
     * @return vod
     */			
	public static function error($msg)
	{
		return self::$Log['root']->error($msg);
	}


}
?>